package com.ruoyi.web.controller.market.special;

import java.util.List;
import java.util.Map;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.db.domain.SpecialDataStarCountInfo;
import com.ruoyi.special.service.ISpecialDataStarCountInfoService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.web.wapper.SpecialDataStarCountInfoWapper;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 机构数据星级统计Controller
 * 
 * @author ruoyi
 * @date 2024-11-11
 */
@Controller
@RequestMapping("/special/starCountInfo")
public class SpecialDataStarCountInfoController extends BaseController
{
    private String prefix = "special/starCountInfo";

    @Autowired
    private ISpecialDataStarCountInfoService specialDataStarCountInfoService;

    @RequiresPermissions("special:starCountInfo:list")
    @GetMapping()
    public String starCountInfo()
    {
        return prefix + "/starCountInfo";
    }

    /**
     * 查询机构数据星级统计列表
     */
    @RequiresPermissions("special:starCountInfo:list")
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(SpecialDataStarCountInfo specialDataStarCountInfo)
    {
        startPage();
        List<Map<String, Object>> mapList = specialDataStarCountInfoService.selectSpecialDataStarCountInfoListMap(specialDataStarCountInfo);
        mapList = new SpecialDataStarCountInfoWapper(mapList).wrap();
        return getDataTable(mapList);
    }

    /**
     * 导出机构数据星级统计列表
     */
    @RequiresPermissions("special:starCountInfo:export")
    @Log(title = "机构数据星级统计", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @ResponseBody
    public AjaxResult export(SpecialDataStarCountInfo specialDataStarCountInfo)
    {
        List<SpecialDataStarCountInfo> list = specialDataStarCountInfoService.selectSpecialDataStarCountInfoList(specialDataStarCountInfo);
        ExcelUtil<SpecialDataStarCountInfo> util = new ExcelUtil<SpecialDataStarCountInfo>(SpecialDataStarCountInfo.class);
        return util.exportExcel(list, "机构数据星级统计数据");
    }

    /**
     * 新增机构数据星级统计
     */
    @GetMapping("/add")
    public String add()
    {
        return prefix + "/add";
    }

    /**
     * 新增保存机构数据星级统计
     */
    @RequiresPermissions("special:starCountInfo:add")
    @Log(title = "机构数据星级统计", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    @ResponseBody
    public AjaxResult addSave(SpecialDataStarCountInfo specialDataStarCountInfo)
    {
        return toAjax(specialDataStarCountInfoService.insertSpecialDataStarCountInfo(specialDataStarCountInfo));
    }

    /**
     * 修改机构数据星级统计
     */
    @RequiresPermissions("special:starCountInfo:edit")
    @GetMapping("/edit/{id}")
    public String edit(@PathVariable("id") Long id, ModelMap mmap)
    {
        SpecialDataStarCountInfo specialDataStarCountInfo = specialDataStarCountInfoService.selectSpecialDataStarCountInfoById(id);
        mmap.put("specialDataStarCountInfo", specialDataStarCountInfo);
        return prefix + "/edit";
    }

    /**
     * 修改保存机构数据星级统计
     */
    @RequiresPermissions("special:starCountInfo:edit")
    @Log(title = "机构数据星级统计", businessType = BusinessType.UPDATE)
    @PostMapping("/edit")
    @ResponseBody
    public AjaxResult editSave(SpecialDataStarCountInfo specialDataStarCountInfo)
    {
        return toAjax(specialDataStarCountInfoService.updateSpecialDataStarCountInfo(specialDataStarCountInfo));
    }

    /**
     * 删除机构数据星级统计
     */
    @RequiresPermissions("special:starCountInfo:remove")
    @Log(title = "机构数据星级统计", businessType = BusinessType.DELETE)
    @PostMapping( "/remove")
    @ResponseBody
    public AjaxResult remove(String ids)
    {
        return toAjax(specialDataStarCountInfoService.deleteSpecialDataStarCountInfoByIds(ids));
    }
}
